#include <stdio.h>
#include <stdlib.h>
#include <string.h>

char * longestPalindrome(char * s){
	char *p = NULL;
	char *ret = NULL;
	char buff[1000] = {0};
	int count, i;
	int max = 0;
	int k = 0;

	while (*s)
	{
		count = 0;
	 	i = 0;
		k = 0;

		for (p = s; *p; p++,i++)
		{
			buff[k++] = *p;
			count++;
			if ((*p == *s) && i)
				break;
		}
		if (*p == '\0')
		{
			count = 1;
		}
		if (count > max)
		{
			max = count;
			ret = (char *)calloc(max,sizeof(char));
			strncpy(ret,buff,max);	
		}
		s++;
	}
	return ret;


}

int main()
{
	char *ret = NULL;
	char arr[1000] = {0};
	fgets(arr,1000,stdin);
	ret = longestPalindrome(arr);
	puts(ret);

	exit(0);
}
